<?php echo $this->render('/public/header');?>
<div id="main" class="col-lg-12 col-md-12 col-sm-12">
	<form>
		<div class="form-inline">
			<input type="text" value="<?php echo yii::$app->request->get('number');?>"class="form-control" name="number" placeholder="搜索客户编号" />
			<input type="text" value="<?php echo yii::$app->request->get('customer_name');?>"class="form-control" name="customer_name" placeholder="搜索客户名称">
			<select class="form-control" name="service_name">
				<option value=0>--选择业务员--</option>
				<?php foreach ($this->params['staff_list'] as $k => $v):?>
					<option <?php if(yii::$app->request->get('service_name')==$v['job_number']){echo 'selected';}?> value=<?php echo $v['job_number'];?>><?php echo $v['name'];?></option>
				<?php endforeach;?>
			</select>
			<button class="btn btn-success">搜索</button>
		</div>
	</form>
	<br/>
	<table class="table table-borderd">
		<thead>
			<tr>
				<th>客户编号</th>
				<th>客户名称</th>
				<th>业务员</th>
				<th>转汇净额</th>
				<th>汇率</th>
				<th>样品收入</th>
				<th>样品支出</th>
				<th>样品快递支出</th>
				<th>样品费结余</th>
                <th style="width:250px">详情</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($this->params['list'] as $key => $v):?>
				<tr>
					<td><?php echo $v['number'];?></td>
					<td><?php echo $v['customer_name'];?></td>
					<td><?php echo $v['zh_name'];?></td>
					<td>$<?php echo $clean = ($v['in_come']+$v['total_fee']+$v['fee']);?></td>
					<td>6.75</td>
					<td>￥<?php echo $in_money = isset($v['bank'])?($v['bank']['in_money']):0;?></td>
					<td>￥<?php echo $out_money=isset($v['bank'])?($v['bank']['out_money']):0;?></td>
					<td>￥<?php echo $ship = isset($v['ship'])?$v['ship']:0;?></td>
					<td>￥<?php echo round(($clean*6.75+$in_money-$out_money-$ship),2);?></td>
                    <td>
                        <a target="_blank" href="/table/income?number=<?php echo $v['number'];?>&property_p=18" class="btn btn-success">转入</a>
                        <a target="_blank" href="/table/bank?number=<?php echo $v['number'];?>&type=2" class="btn btn-primary">转出</a>
                        <a target="_blank" href="/table/express_list?customer_number=<?php echo $v['number'];?>&type=2" class="btn btn-danger">样品快递费</a>
                    </td>
				</tr>
			<?php endforeach;?>
		</tbody>
	</table>
	<div id="page" style="display: inline-block;"></div>
	<span>共有<?php echo $this->params['page']['total'];?>条记录</span>
</div>
<script type="text/javascript">
	layui.laypage({
		cont: 'page' 
		,pages: <?php echo $this->params['page']['page'];?> 
		,curr:<?php echo $this->params['page']['curr'];?>
		,skin: '#5FB878'
		,skip: true 
		,jump: function(obj, first){
			if(!first){
				if(window.location.search)
				{
					window.location.href="<?php echo $this->params['page']['base_url'];?>"+"&p="+obj.curr;
				}
				else
				{
					window.location.href="<?php echo $this->params['page']['base_url'];?>"+"?p="+obj.curr;
				}
			}
		}
	});
</script>
<?php echo $this->render('/public/footer');?>